package controllers.remberme

import jp.t2v.lab.play2.auth.AuthElement
import models.Role
import play.api.mvc.Controller
import views.html

object Messages extends Controller with Pjax with AuthElement with AuthConfigImp {

  def main = StackAction(AuthorityKey -> Role.NormalUser) { implicit request =>
    val title = "message main"
    Ok(html.message.main(title))
  }

  def list = StackAction(AuthorityKey -> Role.NormalUser) { implicit request =>
    val title = "all messages"
    Ok(html.message.list(title))
  }

  def detail(id: Int) = StackAction(AuthorityKey -> Role.NormalUser) { implicit request =>
    val title = "messages detail "
    Ok(html.message.detail(title + id))
  }

  def write = StackAction(AuthorityKey -> Role.Administrator) { implicit request =>
    val title = "write message"
    Ok(html.message.write(title))
  }

  protected val fullTemplate: User => Template = html.remberme.fullTemplate.apply

}



